//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tyr_artillery\fn_request.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

if ([player] call FUNC(checkPlayer)) then {
	_this spawn {
		openmap(true);
		waituntil { visibleMap || !alive player };
		hint localize "STR_TYR_ARTY_CLICKONMAP";
		[QGVAR(MAP_EVT_ID), "onMapSingleClick", { 
				TRACE_1("Start",_this); 
				TRACE_1("Pos",_pos);
				GVAR(position) = _pos;
				if (IS_MARKER(GVAR(ARTY_MARKER))) then {
					GVAR(ARTY_MARKER) setMarkerPosLocal _pos;
					GVAR(ARTY_MARKER) setMarkerAlphaLocal 1;
				};
				createDialog "TYR_ARTY_request_ui";
				TRACE("End");
			}] call BIS_fnc_addStackedEventHandler;
		waituntil {!visibleMap};
		GVAR(ARTY_MARKER) setMarkerAlphaLocal 0;
		[QGVAR(MAP_EVT_ID), "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
	};
};
TRACE("End");
TMFPROFILERSTOP;
